# script
# source <(curl -sSLf https://gitee.com/slcnx/tools/raw/master/scripts/proxy/addosproxy.sh)
# --script-http-proxy    ,_HTTP_PROXY    ,0    ,script级 http代理
# --script-no-proxy    ,_NO_PROXY    ,1    ,script级 哪些IP可以不代理，给127.0.0.1,localhost追加
# export _HTTP_PROXY=$_HTTP_PROXY
# export _NO_PROXY=$_NO_PROXY

# cmd
# source <(curl -sSLf https://gitee.com/slcnx/tools/raw/master/scripts/proxy/addosproxy.sh)
# export _HTTP_PROXY=http://192.168.13.103:33000
# export _NO_PROXY=192.168.13.0/24,127.0.0.1,localhost


function tmpproxy() {
  _HTTP_PROXY=$1
  _NO_PROXY=$2
  export  http_proxy="$_HTTP_PROXY"
  export  https_proxy="$_HTTP_PROXY"
  export  ftp_proxy="$_HTTP_PROXY"
  export  no_proxy="$_NO_PROXY"
  export  HTTP_PROXY="$_HTTP_PROXY"
  export  HTTPS_PROXY="$_HTTP_PROXY"
  export  FTP_PROXY="$_HTTP_PROXY"
  export  NO_PROXY="$_NO_PROXY"
}

function removeproxy() {
  unset http_proxy
  unset https_proxy
  unset ftp_proxy
  unset no_proxy

  unset HTTP_PROXY
  unset HTTPS_PROXY
  unset FTP_PROXY
  unset NO_PROXY
}


function mycurl() {
  tmpproxy $_HTTP_PROXY $_NO_PROXY
  curl $@
  removeproxy
}
function mywget() {
  tmpproxy $_HTTP_PROXY $_NO_PROXY
  wget $@
  removeproxy
}
